layui.use(['form', 'upload'], function(){  //如果只加载一个模块，可以不填数组。如：layui.use('form')
    let upload = layui.upload; //获取upload模块
    //执行实例 /bookCard/manage/upload
     upload.render({
        elem: '#headPic'
        ,url: '/bookCard/manage/upload'
        ,accept:'images'
        ,method: 'POST'
        ,size:'1024'//限制大小,单位kb
         ,done: function(res){
             layer.msg('上传成功');
             //layui.$('#headPicView').removeClass('layui-hide').find('img').attr('src', res.url);
             layui.$('#headPicView').attr('src', res.url);
             console.log(res)
         }
    })

});
function bookCardFormSave() {
    let bookCardForm = $("#bookCardForm").serializeObject();
    $.post(ctx + "/bookCard/manage/save", bookCardForm, function (data) {
        layer.msg("保存成功", {icon: 1,time: 2000}, function () {});
    });
}